package inabit.utils;

import inabit.data.expression.Expression;
/**Substitutes the tags at the expression string form
 * by specific values
 * @author Rafael Rocha*/
public class ExpressionStringFormat {
	private String and;
	private String or;
	private String not;
	
	public ExpressionStringFormat() {
		setFormat("and", "or", "not");
	}
	public void setAndString(String and) {
		this.and = and;
	}
	public void setOrString(String or){
		this.or = or;
	}
	public void setNotString(String not) {
		this.not = not;
	}
	public void setFormat(String and, String or, String not) {
		this.and = and;
		this.or = or;
		this.not = not;
	}
	public String format(Expression exp) {
		return formatString(exp.toString());
	}
	public String formatString(String expString) {
		expString = expString.replaceAll("<and>", and);
		expString = expString.replaceAll("<or>", or);
		expString = expString.replaceAll("<not>", not);
		
		return expString;
	}
	
	public String getAndString() {
		return and;
	}
	public String getOrString() {
		return or;
	}
	public String getNotString() {
		return not;
	}
}
